﻿using System;
using ActivityFeed.Web.RavenDB;
using OpenWaves.ActivityFeed.Web.Controls;

namespace OpenWaves.ActivityFeed.Web.RavenDB
{
    public class RavenDBActivityFeedBuilderFactory : IActivityFeedBuilderFactory
    {
        public ActivityFeedBuilder Create(FeedType feedType, string customFeedTypeName, IActivityFeedService activityFeedService,
                                 IUpdateDtoBuilder updateDtoBuilder, string identityName)
        {
            switch (feedType)
            {
                case FeedType.Global:
                    return new GlobalActivityFeedBuilder(activityFeedService, updateDtoBuilder);
                case FeedType.Personal:
                    return new PersonalActivityFeedBuilder(identityName, activityFeedService, updateDtoBuilder);
                default:
                    throw new ArgumentException(ExceptionMessage.Format("Unexpected feed type: {0}.", feedType),
                                                "feedType");
            }
        }

    }
}